package base.dao;

import base.bean.Checkin;
import base.bean.PersonsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by 30509 on 2018/3/18.
 */
@Repository
public interface IPersonDao extends JpaRepository<PersonsEntity,Integer>{
    @Modifying
    @Transactional
    Checkin deleteById(int id);


    @Modifying
    @Transactional
    @Query(value = "update checkin u set u.personname=?1, u.roomid=?2, u.cardtype=?3, u.cardid=?4, u.sex=?5, u.phone=?6 " +
            "where u.id = ?7", nativeQuery = true)
    void updateNameById(String personname, int roomiid, String cardtype, String cardid, String sex, String phone, int id);
}
